home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 2
/
Gold Medal Software Volume 2 (Gold Medal) (1994).iso
/
windows
/
win31
/
macsyma.arj
/
MACSDEMO.EXE
/
ODE.OUT
< prev
next >
Wrap
Text File
|
1993-09-14
|
6KB
|
108 lines
(c1) /*
DEMONSTRATION OF PACKAGE `ODE',
for Solving Ordinary Differential Equations
1. FIRST ORDER O.D.E.'S
*/
(kill(x,y), depends(y,x))$
(c2) /* Let's start with some easy ones ... */
diff(y,x)=y*tan(x);
|$label(0,15,Times New Roman,$(d2$))$q(dy,dx)$hinge()$in( = )tan$paren(x)$hinge()$in( )y
(c3) ode(%,y,x);
C:\MACSD2B\ode\odeaux.fas being loaded.
C:\MACSD2B\ode\ode2.fas being loaded.
|$label(0,15,Times New Roman,$(d3$))y$hinge()$in( = )%c$hinge()$in( )sec$paren(x)
(c4) /* We can find out how we solved it with ... */
method;
|$label(0,15,Times New Roman,$(d4$))linear
(c5) /* We can set ODETUTOR:TRUE to get more commentary on what is going on. */
odetutor:true$
(c6) /* The following is Murphy-267, solved as a Riccati in the text. */
x^2*diff(y,x)+2+x*y*(4+x*y)=0;
|$label(0,15,Times New Roman,$(d6$))$sup(x,2)$in( )$q(dy,dx)$hinge()$in( + )x$in( )y$in( )$paren(x$in( )y$in( + )4,$(,$))$hinge()$in( + )2$hinge()$in( = )0
(c7) ode(%,y,x);
|$label(-1,15,Times New Roman,)Trying $in() $in()ode2
|$label(0,15,Times New Roman,$(d7$))x$hinge()$in( = )$q(%c$in( )$paren(x$in( )y$in( + )2,$(,$)),x$in( )y$in( + )1)
(c8) /* Of course, we know it was a Riccati, but ... */
method;
|$label(0,15,Times New Roman,$(d8$))genhom
(c9) /* Hmmmm. Guess Murphy did it the hard way!
Well, let's have a real Riccati: Murphy-300. */
(1-x^2)*diff(y,x)=1-(2*x-y)*y;
|$label(0,15,Times New Roman,$(d9$))$open($()1$hinge()$in( - )$sup(x,2)$close($))$hinge()$in( )$q(dy,dx)$hinge()$in( = )1$hinge()$in( - )$paren(2$in( )x$in( - )y,$(,$))$in( )y
(c10) ode(%,y,x);
|$label(-1,15,Times New Roman,)Trying $in() $in()ode2
|$label(-1,15,Times New Roman,)Trying $in() $in()nonlin
C:\MACSD2B\ode\abel.fas being loaded.
|$label(-1,15,Times New Roman,)Trying $in() $in()riccati
C:\MACSD2B\ode\ricati.fas being loaded.
|$label(-1,15,Times New Roman,)Trying $in() $in()schmidt
C:\MACSD2B\ode\schmid.fas being loaded.
|$label(-1,15,Times New Roman,)FOUND $in() $in()$paren(x,[,])
|$label(0,15,Times New Roman,$(d10$))y$hinge()$in( = )$q(x$in( )log$paren(x$in( + )1)$in( - )x$in( )log$paren(x$in( - )1)$in( - )2$in( )%c$in( )x$in( - )2,log$paren(x$in( + )1)$in( - )log$paren(x$in( - )1)$in( - )2$in( )%c)
(c11) /* We are not limited to numeric coefficients either. The Schmidt
algorithm will try to find symbolic particular solutions. */
/* Kamke-1.104 */
x*diff(y,x)+a*x*y^2+2*y+b*x=0;
|$label(0,15,Times New Roman,$(d11$))x$in( )$q(dy,dx)$hinge()$in( + )a$in( )x$in( )$sup(y,2)$hinge()$in( + )2$in( )y$hinge()$in( + )b$in( )x$hinge()$in( = )0
(c12) /* We can also force a specific method if we are sure of the type
(but we lose more often than not if we do it). */
ode(%,y,x,riccati);
|$label(-1,15,Times New Roman,)Trying $in() $in()riccati
|$label(-1,15,Times New Roman,)Trying $in() $in()schmidt
|$label(-1,15,Times New Roman,)FOUND $in() $in()$paren($sqrt($in( - )$q(b,a))$in( - )$q(1,a$in( )x)$ina($, )$hinge()$in( - )$q(1,a$in( )x)$in( - )$sqrt($in( - )$q(b,a)),[,])
|$label(0,15,Times New Roman,$(d12$))y$hinge()$in( = )$in( - )$q($paren(2$in( )%c$in( )b$in( )x$in( + )2$in( )%c$in( )$sqrt($in( - )$q(b,a)),$(,$))$in( )$sup($e(),2$in( )a$in( )$sqrt($in( - )b$in(/)a)$in( )x)$in( - )a$in( )$sqrt($in( - )$q(b,a))$in( )x$in( - )1,2$in( )%c$in( )a$in( )$sqrt($in( - )$q(b,a))$in( )x$in( )$sup($e(),2$in( )a$in( )$sqrt($in( - )b$in(/)a)$in( )x)$in( - )a$in( )x)
(c13) /*
2. SECOND ORDER O.D.E.'S
*/
/* To demonstrate ODE's capability for second order and higher, we
start with some of the more difficult cases and ask for specific
methods to save demo time. (The normal mode is to apply ODE and
let it try various methods.) */
/* Try one which won't yield to elementary methods, the Legendre equation.
*/
eq: (1-x^2)*diff(y,x,2)-2*x*diff(y,x)+n*(n+1)*y=0;
|$label(0,15,Times New Roman,$(d13$))$paren(1$in( - )$sup(x,2),$(,$))$in( )$q($sup(d,2)y,d$sup(x,2))$hinge()$in( - )2$in( )x$in( )$q(dy,dx)$hinge()$in( + )n$in( )$paren(n$in( + )1,$(,$))$in( )y$hinge()$in( = )0
(c14) assume(n>0)$
(c15) ode(eq,y,x,solvehyper);
|$label(-1,15,Times New Roman,)Trying $in() $in()solvehyper
C:\MACSD2B\ode\hyper.fas being loaded.
C:\MACSD2B\ode\sings.fas being loaded.
|$label(-1,15,Times New Roman,)The singularities are:$in() $in()$matrix(3,1,$in( - )1,1,$greektext(Ñ))$in() $in()Choose one.
1;
|$label(-1,15,Times New Roman,)Circle or halfplane?
HALFPLANE;
|$label(0,15,Times New Roman,$(d15$))y$hinge()$in( = )$q(%k2$in( )$paren($sub(alegendre_p,- n- 1$ina($, )$hinge()0)$paren(x)$in( )log$paren($q(x$in( - )1,x$in( + )1))$in( + )$paren(2$in( )$sub($greektext(y),0)$paren(n$in( + )3)$in( - )2$in( )$sub($greektext(y),0)$paren(n$in( + )1)$in( - )3,$(,$))$in( )$sub(alegendre_p,- n- 1$ina($, )$hinge()0)$paren(x),$(,$))$in( + )%k1$in( )$sub(alegendre_p,- n- 1$ina($, )$hinge()0)$paren(x),$sup($paren($q(1,x$in( + )1),$(,$)),n)$in( )$sup($paren(x$in( + )1,$(,$)),n))
(c16) /* If you chose one of the singularities at +-1, then this step will
simplify the result. (If you chose INF, this command is unnecessary,
and presence of the undefined array function %Q generates an error .)
*/
errcatch(ev(%, %k2=0, ratsimp));
|$label(0,15,Times New Roman,$(d16$))$open([)y$hinge()$in( = )$q(%k1$in( )$sub(alegendre_p,- n- 1$ina($, )$hinge()0)$paren(x),$sup($paren($q(1,x$in( + )1),$(,$)),n)$in( )$sup($paren(x$in( + )1,$(,$)),n))$close(])
(c17) /* Voila, Legendre function denoted in Macsyma by %P[]() */
/* That's fine if we know it is a hypergeometric. There is also a
set solution method for Whittaker equations (see Rainville,
Intermediate Differential Equations). */
/* Also try DEMO(ODE1); DEMO(ODE2); DEMO(ODEFI); and DEMO(ODELIN2); .
Clean Up */
(reset(odetutor), remove(y,dependency), remvalue(eq), forget(n>0))$